home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / PInterfaces / MacTCP.p < prev    next >
Encoding:
Text File  |  1998-08-17  |  21.0 KB  |  833 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        MacTCP.p
  3.  
  4.      Contains:    TCP Manager Interfaces.
  5.  
  6.      Version:    Technology:    MacTCP 2.0.6
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1989-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. }
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT MacTCP;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __MACTCP__}
  27. {$SETC __MACTCP__ := 1}
  28.  
  29. {$I+}
  30. {$SETC MacTCPIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33. {$IFC UNDEFINED __MACTYPES__}
  34. {$I MacTypes.p}
  35. {$ENDC}
  36. {$IFC UNDEFINED __MIXEDMODE__}
  37. {$I MixedMode.p}
  38. {$ENDC}
  39. {$IFC UNDEFINED __APPLETALK__}
  40. {$I AppleTalk.p}
  41. {$ENDC}
  42.  
  43.  
  44. {$PUSH}
  45. {$ALIGN MAC68K}
  46. {$LibExport+}
  47.  
  48. {
  49. Developer Notes:
  50.         0. This MacTCP header replaces what used to be defined in the following header files
  51.             MacTCPCommonTypes.h
  52.             GetMyIPAddr.h
  53.             MiscIPPB.h
  54.             TCPPB.h
  55.             UDPPB.h 
  56.             
  57.             When the various control calls are made to the ip driver, you must set up a 
  58.             NewRoutineDescriptor for every non-nil completion routine and/or notifyProc parameter.  
  59.             Otherwise, the 68K driver code, will not correctly call your routine.
  60.         1. For ipctlGetAddr Control calls, use NewGetIPIOCompletionProc
  61.             to set up a GetIPIOCompletionUPP universal procptr to pass as
  62.             the ioCompletion parameter.
  63.         2. For the ipctlEchoICMP and ipctlLAPStats Control calls, use 
  64.             NewIPIOCompletion to set up a IPIOCompletionUPP universal procptr
  65.             to pass in the ioCompletion field of the parameter block.
  66.         3. For TCPCreatePB Control calls, use NewTCPNotifyProc to set up a
  67.             TCPNotifyUPP universal procptr to pass in the notifyProc field
  68.             of the parameter block
  69.         4. For all of the TCP Control calls using the TCPiopb parameter block,
  70.             use NewTCPIOCompletionProc to set up a TCPIOCompletionUPP
  71.             universal procptr to pass in the ioCompletion field of the paramter
  72.             block.
  73.         5. For UDBCreatePB Control calls, use NewUDPNotifyProc to set up a
  74.             UDPNotifyUPP universal procptr to pass in the notifyProc field
  75.             of the parameter block
  76.         6. For all of the UDP Control calls using the UDPiopb parameter block,
  77.             use NewUDPIOCompletionProc to set up a UDPIOCompletionUPP
  78.             universal procptr to pass in the ioCompletion field of the paramter
  79.             block.
  80.         7. For all calls implementing a notifyProc or ioCompletion routine
  81.             which was set up using a NewTCPRoutineProc call, do not call
  82.             DisposeRoutineSDescriptor on the universal procptr until
  83.             after the completion or notify proc has completed.
  84. }
  85.  
  86. { MacTCP return Codes in the range -23000 through -23049 }
  87.  
  88. CONST
  89.     inProgress                    = 1;                            {  I/O in progress  }
  90.     ipBadLapErr                    = -23000;                        {  bad network configuration  }
  91.     ipBadCnfgErr                = -23001;                        {  bad IP configuration error  }
  92.     ipNoCnfgErr                    = -23002;                        {  missing IP or LAP configuration error  }
  93.     ipLoadErr                    = -23003;                        {  error in MacTCP load  }
  94.     ipBadAddr                    = -23004;                        {  error in getting address  }
  95.     connectionClosing            = -23005;                        {  connection is closing  }
  96.     invalidLength                = -23006;
  97.     connectionExists            = -23007;                        {  request conflicts with existing connection  }
  98.     connectionDoesntExist        = -23008;                        {  connection does not exist  }
  99.     insufficientResources        = -23009;                        {  insufficient resources to perform request  }
  100.     invalidStreamPtr            = -23010;
  101.     streamAlreadyOpen            = -23011;
  102.     connectionTerminated        = -23012;
  103.     invalidBufPtr                = -23013;
  104.     invalidRDS                    = -23014;
  105.     invalidWDS                    = -23014;
  106.     openFailed                    = -23015;
  107.     commandTimeout                = -23016;
  108.     duplicateSocket                = -23017;
  109.  
  110. { Error codes from internal IP functions }
  111.     ipDontFragErr                = -23032;                        {  Packet too large to send w/o fragmenting  }
  112.     ipDestDeadErr                = -23033;                        {  destination not responding  }
  113.     icmpEchoTimeoutErr            = -23035;                        {  ICMP echo timed-out  }
  114.     ipNoFragMemErr                = -23036;                        {  no memory to send fragmented pkt  }
  115.     ipRouteErr                    = -23037;                        {  can't route packet off-net  }
  116.     nameSyntaxErr                = -23041;
  117.     cacheFault                    = -23042;
  118.     noResultProc                = -23043;
  119.     noNameServer                = -23044;
  120.     authNameErr                    = -23045;
  121.     noAnsErr                    = -23046;
  122.     dnrErr                        = -23047;
  123.     outOfMemory                    = -23048;
  124.  
  125.  
  126.     BYTES_16WORD                = 2;                            {  bytes per = 16, bit ip word  }
  127.     BYTES_32WORD                = 4;                            {  bytes per = 32, bit ip word  }
  128.     BYTES_64WORD                = 8;                            {  bytes per = 64, bit ip word  }
  129.  
  130. { 8-bit quantity }
  131.  
  132. TYPE
  133.     b_8                                    = UInt8;
  134. { 16-bit quantity }
  135.     b_16                                = UInt16;
  136. { 32-bit quantity }
  137.     b_32                                = UInt32;
  138. { IP address is 32-bits }
  139.     ip_addr                                = b_32;
  140.     ip_addrbytesPtr = ^ip_addrbytes;
  141.     ip_addrbytes = RECORD
  142.         CASE INTEGER OF
  143.         0: (
  144.             addr:                b_32;
  145.             );
  146.         1: (
  147.             byte:                PACKED ARRAY [0..3] OF UInt8;
  148.             );
  149.     END;
  150.  
  151.     wdsEntryPtr = ^wdsEntry;
  152.     wdsEntry = RECORD
  153.         length:                    UInt16;                                    {  length of buffer  }
  154.         ptr:                    Ptr;                                    {  pointer to buffer  }
  155.     END;
  156.  
  157.     rdsEntryPtr = ^rdsEntry;
  158.     rdsEntry = RECORD
  159.         length:                    UInt16;                                    {  length of buffer  }
  160.         ptr:                    Ptr;                                    {  pointer to buffer  }
  161.     END;
  162.  
  163.     BufferPtr                            = UInt32;
  164.     StreamPtr                            = UInt32;
  165.  
  166. CONST
  167.     netUnreach                    = 0;
  168.     hostUnreach                    = 1;
  169.     protocolUnreach                = 2;
  170.     portUnreach                    = 3;
  171.     fragReqd                    = 4;
  172.     sourceRouteFailed            = 5;
  173.     timeExceeded                = 6;
  174.     parmProblem                    = 7;
  175.     missingOption                = 8;
  176.     lastICMPMsgType                = 32767;
  177.  
  178.  
  179. TYPE
  180.     ICMPMsgType                            = UInt16;
  181.     ip_port                                = b_16;
  182.     ICMPReportPtr = ^ICMPReport;
  183.     ICMPReport = RECORD
  184.         streamPtr:                StreamPtr;
  185.         localHost:                ip_addr;
  186.         localPort:                ip_port;
  187.         remoteHost:                ip_addr;
  188.         remotePort:                ip_port;
  189.         reportType:                INTEGER;
  190.         optionalAddlInfo:        UInt16;
  191.         optionalAddlInfoPtr:    UInt32;
  192.     END;
  193.  
  194. { csCode to get our IP address }
  195.  
  196. CONST
  197.     ipctlGetAddr                = 15;
  198.  
  199.  
  200. TYPE
  201.     GetAddrParamBlockPtr = ^GetAddrParamBlock;
  202. {$IFC TYPED_FUNCTION_POINTERS}
  203.     GetIPIOCompletionProcPtr = PROCEDURE(VAR iopb: GetAddrParamBlock); C;
  204. {$ELSEC}
  205.     GetIPIOCompletionProcPtr = ProcPtr;
  206. {$ENDC}
  207.  
  208.     GetIPIOCompletionUPP = UniversalProcPtr;
  209.     GetAddrParamBlock = RECORD
  210.         qLink:                    QElemPtr;
  211.         qType:                    INTEGER;
  212.         ioTrap:                    INTEGER;
  213.         ioCmdAddr:                Ptr;
  214.         ioCompletion:            GetIPIOCompletionUPP;
  215.         ioResult:                OSErr;
  216.         ioNamePtr:                StringPtr;
  217.         ioVRefNum:                INTEGER;
  218.         ioCRefNum:                INTEGER;
  219.         csCode:                    INTEGER;
  220.         ourAddress:                ip_addr;                                {  our IP address  }
  221.         ourNetMask:                LONGINT;                                {  our IP net mask  }
  222.     END;
  223.  
  224. { control codes }
  225.  
  226. CONST
  227.     ipctlEchoICMP                = 17;                            {  send icmp echo  }
  228.     ipctlLAPStats                = 19;                            {  get lap stats  }
  229.  
  230.  
  231.  
  232. TYPE
  233.     ICMPParamBlockPtr = ^ICMPParamBlock;
  234. {$IFC TYPED_FUNCTION_POINTERS}
  235.     IPIOCompletionProcPtr = PROCEDURE(VAR iopb: ICMPParamBlock); C;
  236. {$ELSEC}
  237.     IPIOCompletionProcPtr = ProcPtr;
  238. {$ENDC}
  239.  
  240.     IPIOCompletionUPP = UniversalProcPtr;
  241.     ICMPParamBlock = RECORD
  242.         qLink:                    QElemPtr;
  243.         qType:                    INTEGER;
  244.         ioTrap:                    INTEGER;
  245.         ioCmdAddr:                Ptr;
  246.         ioCompletion:            IPIOCompletionUPP;
  247.         ioResult:                OSErr;
  248.         ioNamePtr:                StringPtr;
  249.         ioVRefNum:                INTEGER;
  250.         ioCRefNum:                INTEGER;
  251.         csCode:                    INTEGER;
  252.         params:                    ARRAY [0..10] OF INTEGER;
  253.         echoRequestOut:            UInt32;                                    {  time in ticks of when the echo request went out  }
  254.         echoReplyIn:            UInt32;                                    {  time in ticks of when the reply was received  }
  255.         echoedData:                rdsEntry;                                {  data received in responce  }
  256.         options:                Ptr;
  257.         userDataPtr:            UInt32;
  258.     END;
  259.  
  260. {$IFC TYPED_FUNCTION_POINTERS}
  261.     ICMPEchoNotifyProcPtr = PROCEDURE(VAR iopb: ICMPParamBlock); C;
  262. {$ELSEC}
  263.     ICMPEchoNotifyProcPtr = ProcPtr;
  264. {$ENDC}
  265.  
  266.     ICMPEchoNotifyUPP = UniversalProcPtr;
  267.     LAPStatsPtr = ^LAPStats;
  268.     IPParamBlockPtr = ^IPParamBlock;
  269.     IPParamBlock = RECORD
  270.         qLink:                    QElemPtr;
  271.         qType:                    INTEGER;
  272.         ioTrap:                    INTEGER;
  273.         ioCmdAddr:                Ptr;
  274.         ioCompletion:            IPIOCompletionUPP;
  275.         ioResult:                OSErr;
  276.         ioNamePtr:                StringPtr;
  277.         ioVRefNum:                INTEGER;
  278.         ioCRefNum:                INTEGER;
  279.         csCode:                    INTEGER;
  280.         CASE INTEGER OF
  281.         0: (
  282.             dest:                ip_addr;                                {  echo to IP address  }
  283.             data:                wdsEntry;
  284.             timeout:            INTEGER;
  285.             options:            Ptr;
  286.             optLength:            UInt16;
  287.             icmpCompletion:        ICMPEchoNotifyUPP;
  288.             userDataPtr:        UInt32;
  289.            );
  290.         1: (
  291.             lapStatsPtr:        LAPStatsPtr;
  292.            );
  293.     END;
  294.  
  295.  
  296.     nbp_entryPtr = ^nbp_entry;
  297.     nbp_entry = RECORD
  298.         ip_address:                ip_addr;                                {  IP address  }
  299.         at_address:                AddrBlock;                                {  matching AppleTalk address  }
  300.         gateway:                BOOLEAN;                                {  TRUE if entry for a gateway  }
  301.         valid:                    BOOLEAN;                                {  TRUE if LAP address is valid  }
  302.         probing:                BOOLEAN;                                {  TRUE if NBP lookup pending  }
  303.         afiller:                SInt8;                                    {  Filler for proper byte alignment      }
  304.         age:                    LONGINT;                                {  ticks since cache entry verified  }
  305.         access:                    LONGINT;                                {  ticks since last access  }
  306.         filler:                    ARRAY [0..115] OF SInt8;                {  for internal use only !!!  }
  307.     END;
  308.  
  309.     Enet_addrPtr = ^Enet_addr;
  310.     Enet_addr = RECORD
  311.         en_hi:                    b_16;
  312.         en_lo:                    b_32;
  313.     END;
  314.  
  315.     arp_entryPtr = ^arp_entry;
  316.     arp_entry = RECORD
  317.         age:                    INTEGER;                                {  cache aging field  }
  318.         protocol:                b_16;                                    {  Protocol type  }
  319.         ip_address:                ip_addr;                                {  IP address  }
  320.         en_address:                Enet_addr;                                {  matching Ethernet address  }
  321.     END;
  322.  
  323.     LAPStatsAddrXlationPtr = ^LAPStatsAddrXlation;
  324.     LAPStatsAddrXlation = RECORD
  325.         CASE INTEGER OF
  326.         0: (
  327.             arp_table:            arp_entryPtr;
  328.             );
  329.         1: (
  330.             nbp_table:            nbp_entryPtr;
  331.             );
  332.     END;
  333.  
  334.     LAPStats = RECORD
  335.         ifType:                    INTEGER;
  336.         ifString:                CStringPtr;
  337.         ifMaxMTU:                INTEGER;
  338.         ifSpeed:                LONGINT;
  339.         ifPhyAddrLength:        INTEGER;
  340.         ifPhysicalAddress:        CStringPtr;
  341.         AddrXlation:            LAPStatsAddrXlation;
  342.         slotNumber:                INTEGER;
  343.     END;
  344.  
  345. { number of ARP table entries }
  346.  
  347. CONST
  348.     ARP_TABLE_SIZE                = 20;
  349.  
  350.     NBP_TABLE_SIZE                = 20;                            {  number of NBP table entries  }
  351.     NBP_MAX_NAME_SIZE            = 28;
  352.  
  353.  
  354.  
  355. { Command codes }
  356.     TCPCreate                    = 30;
  357.     TCPPassiveOpen                = 31;
  358.     TCPActiveOpen                = 32;
  359.     TCPSend                        = 34;
  360.     TCPNoCopyRcv                = 35;
  361.     TCPRcvBfrReturn                = 36;
  362.     TCPRcv                        = 37;
  363.     TCPClose                    = 38;
  364.     TCPAbort                    = 39;
  365.     TCPStatus                    = 40;
  366.     TCPExtendedStat                = 41;
  367.     TCPRelease                    = 42;
  368.     TCPGlobalInfo                = 43;
  369.     TCPCtlMax                    = 49;
  370.  
  371.     TCPClosing                    = 1;
  372.     TCPULPTimeout                = 2;
  373.     TCPTerminate                = 3;
  374.     TCPDataArrival                = 4;
  375.     TCPUrgent                    = 5;
  376.     TCPICMPReceived                = 6;
  377.     lastEvent                    = 32767;
  378.  
  379.  
  380. TYPE
  381.     TCPEventCode                        = UInt16;
  382.  
  383. CONST
  384.     TCPRemoteAbort                = 2;
  385.     TCPNetworkFailure            = 3;
  386.     TCPSecPrecMismatch            = 4;
  387.     TCPULPTimeoutTerminate        = 5;
  388.     TCPULPAbort                    = 6;
  389.     TCPULPClose                    = 7;
  390.     TCPServiceError                = 8;
  391.     lastReason                    = 32767;
  392.  
  393.  
  394. TYPE
  395.     TCPTerminationReason                = UInt16;
  396. {$IFC TYPED_FUNCTION_POINTERS}
  397.     TCPNotifyProcPtr = PROCEDURE(tcpStream: StreamPtr; eventCode: UInt16; userDataPtr: Ptr; terminReason: UInt16; VAR icmpMsg: ICMPReport);
  398. {$ELSEC}
  399.     TCPNotifyProcPtr = ProcPtr;
  400. {$ENDC}
  401.  
  402.     TCPNotifyUPP = UniversalProcPtr;
  403.     tcp_port                            = UInt16;
  404. { ValidityFlags }
  405.  
  406. CONST
  407.     timeoutValue                = $80;
  408.     timeoutAction                = $40;
  409.     typeOfService                = $20;
  410.     precedence                    = $10;
  411.  
  412. { TOSFlags }
  413.     lowDelay                    = $01;
  414.     throughPut                    = $02;
  415.     reliability                    = $04;
  416.  
  417.  
  418. TYPE
  419.     TCPCreatePBPtr = ^TCPCreatePB;
  420.     TCPCreatePB = RECORD
  421.         rcvBuff:                Ptr;
  422.         rcvBuffLen:                UInt32;
  423.         notifyProc:                TCPNotifyUPP;
  424.         userDataPtr:            Ptr;
  425.     END;
  426.  
  427.     TCPOpenPBPtr = ^TCPOpenPB;
  428.     TCPOpenPB = RECORD
  429.         ulpTimeoutValue:        SInt8;
  430.         ulpTimeoutAction:        SInt8;
  431.         validityFlags:            SInt8;
  432.         commandTimeoutValue:    SInt8;
  433.         remoteHost:                ip_addr;
  434.         remotePort:                tcp_port;
  435.         localHost:                ip_addr;
  436.         localPort:                tcp_port;
  437.         tosFlags:                SInt8;
  438.         precedence:                SInt8;
  439.         dontFrag:                BOOLEAN;
  440.         timeToLive:                SInt8;
  441.         security:                SInt8;
  442.         optionCnt:                SInt8;
  443.         options:                ARRAY [0..39] OF SInt8;
  444.         userDataPtr:            Ptr;
  445.     END;
  446.  
  447.  
  448.     TCPSendPBPtr = ^TCPSendPB;
  449.     TCPSendPB = RECORD
  450.         ulpTimeoutValue:        SInt8;
  451.         ulpTimeoutAction:        SInt8;
  452.         validityFlags:            SInt8;
  453.         pushFlag:                BOOLEAN;
  454.         urgentFlag:                BOOLEAN;
  455.         filler:                    SInt8;                                    {  Filler for proper byte alignment      }
  456.         wdsPtr:                    Ptr;
  457.         sendFree:                UInt32;
  458.         sendLength:                UInt16;
  459.         userDataPtr:            Ptr;
  460.     END;
  461.  
  462.  
  463. { for receive and return rcv buff calls }
  464. {   Note: the filler in the following structure is in a different location than }
  465. {         that specified in the Programmer's Guide.  }
  466.     TCPReceivePBPtr = ^TCPReceivePB;
  467.     TCPReceivePB = RECORD
  468.         commandTimeoutValue:    SInt8;
  469.         markFlag:                BOOLEAN;
  470.         urgentFlag:                BOOLEAN;
  471.         filler:                    SInt8;                                    {  Filler for proper byte alignment   }
  472.         rcvBuff:                Ptr;
  473.         rcvBuffLen:                UInt16;
  474.         rdsPtr:                    Ptr;
  475.         rdsLength:                UInt16;
  476.         secondTimeStamp:        UInt16;
  477.         userDataPtr:            Ptr;
  478.     END;
  479.  
  480.  
  481.     TCPClosePBPtr = ^TCPClosePB;
  482.     TCPClosePB = RECORD
  483.         ulpTimeoutValue:        SInt8;
  484.         ulpTimeoutAction:        SInt8;
  485.         validityFlags:            SInt8;
  486.         filler:                    SInt8;                                    {  Filler for proper byte alignment      }
  487.         userDataPtr:            Ptr;
  488.     END;
  489.  
  490.     HistoBucketPtr = ^HistoBucket;
  491.     HistoBucket = RECORD
  492.         value:                    UInt16;
  493.         counter:                UInt32;
  494.     END;
  495.  
  496.  
  497. CONST
  498.     NumOfHistoBuckets            = 7;
  499.  
  500.  
  501. TYPE
  502.     TCPConnectionStatsPtr = ^TCPConnectionStats;
  503.     TCPConnectionStats = RECORD
  504.         dataPktsRcvd:            UInt32;
  505.         dataPktsSent:            UInt32;
  506.         dataPktsResent:            UInt32;
  507.         bytesRcvd:                UInt32;
  508.         bytesRcvdDup:            UInt32;
  509.         bytesRcvdPastWindow:    UInt32;
  510.         bytesSent:                UInt32;
  511.         bytesResent:            UInt32;
  512.         numHistoBuckets:        UInt16;
  513.         sentSizeHisto:            ARRAY [0..6] OF HistoBucket;
  514.         lastRTT:                UInt16;
  515.         tmrSRTT:                UInt16;
  516.         rttVariance:            UInt16;
  517.         tmrRTO:                    UInt16;
  518.         sendTries:                SInt8;
  519.         sourchQuenchRcvd:        SInt8;
  520.     END;
  521.  
  522.     TCPStatusPBPtr = ^TCPStatusPB;
  523.     TCPStatusPB = RECORD
  524.         ulpTimeoutValue:        SInt8;
  525.         ulpTimeoutAction:        SInt8;
  526.         unused:                    LONGINT;
  527.         remoteHost:                ip_addr;
  528.         remotePort:                tcp_port;
  529.         localHost:                ip_addr;
  530.         localPort:                tcp_port;
  531.         tosFlags:                SInt8;
  532.         precedence:                SInt8;
  533.         connectionState:        SInt8;
  534.         filler:                    SInt8;                                    {  Filler for proper byte alignment      }
  535.         sendWindow:                UInt16;
  536.         rcvWindow:                UInt16;
  537.         amtUnackedData:            UInt16;
  538.         amtUnreadData:            UInt16;
  539.         securityLevelPtr:        Ptr;
  540.         sendUnacked:            UInt32;
  541.         sendNext:                UInt32;
  542.         congestionWindow:        UInt32;
  543.         rcvNext:                UInt32;
  544.         srtt:                    UInt32;
  545.         lastRTT:                UInt32;
  546.         sendMaxSegSize:            UInt32;
  547.         connStatPtr:            TCPConnectionStatsPtr;
  548.         userDataPtr:            Ptr;
  549.     END;
  550.  
  551.     TCPAbortPBPtr = ^TCPAbortPB;
  552.     TCPAbortPB = RECORD
  553.         userDataPtr:            Ptr;
  554.     END;
  555.  
  556.     TCPParamPtr = ^TCPParam;
  557.     TCPParam = RECORD
  558.         tcpRtoA:                UInt32;
  559.         tcpRtoMin:                UInt32;
  560.         tcpRtoMax:                UInt32;
  561.         tcpMaxSegSize:            UInt32;
  562.         tcpMaxConn:                UInt32;
  563.         tcpMaxWindow:            UInt32;
  564.     END;
  565.  
  566.     TCPStatsPtr = ^TCPStats;
  567.     TCPStats = RECORD
  568.         tcpConnAttempts:        UInt32;
  569.         tcpConnOpened:            UInt32;
  570.         tcpConnAccepted:        UInt32;
  571.         tcpConnClosed:            UInt32;
  572.         tcpConnAborted:            UInt32;
  573.         tcpOctetsIn:            UInt32;
  574.         tcpOctetsOut:            UInt32;
  575.         tcpOctetsInDup:            UInt32;
  576.         tcpOctetsRetrans:        UInt32;
  577.         tcpInputPkts:            UInt32;
  578.         tcpOutputPkts:            UInt32;
  579.         tcpDupPkts:                UInt32;
  580.         tcpRetransPkts:            UInt32;
  581.     END;
  582.  
  583.     StreamPPtr                            = ^StreamPtr;
  584.     TCPGlobalInfoPBPtr = ^TCPGlobalInfoPB;
  585.     TCPGlobalInfoPB = RECORD
  586.         tcpParamPtr:            TCPParamPtr;
  587.         tcpStatsPtr:            TCPStatsPtr;
  588.         tcpCDBTable:            ARRAY [0..0] OF StreamPPtr;
  589.         userDataPtr:            Ptr;
  590.         maxTCPConnections:        UInt16;
  591.     END;
  592.  
  593.     TCPiopbPtr = ^TCPiopb;
  594. {$IFC TYPED_FUNCTION_POINTERS}
  595.     TCPIOCompletionProcPtr = PROCEDURE(VAR iopb: TCPiopb); C;
  596. {$ELSEC}
  597.     TCPIOCompletionProcPtr = ProcPtr;
  598. {$ENDC}
  599.  
  600.     TCPIOCompletionUPP = UniversalProcPtr;
  601.     TCPiopb = RECORD
  602.         fill12:                    ARRAY [0..11] OF SInt8;
  603.         ioCompletion:            TCPIOCompletionUPP;
  604.         ioResult:                INTEGER;
  605.         ioNamePtr:                Ptr;
  606.         ioVRefNum:                INTEGER;
  607.         ioCRefNum:                INTEGER;
  608.         csCode:                    INTEGER;
  609.         tcpStream:                StreamPtr;
  610.         CASE INTEGER OF
  611.         0: (
  612.             create:                TCPCreatePB;
  613.             );
  614.         1: (
  615.             open:                TCPOpenPB;
  616.             );
  617.         2: (
  618.             send:                TCPSendPB;
  619.             );
  620.         3: (
  621.             receive:            TCPReceivePB;
  622.             );
  623.         4: (
  624.             close:                TCPClosePB;
  625.             );
  626.         5: (
  627.             abort:                TCPAbortPB;
  628.             );
  629.         6: (
  630.             status:                TCPStatusPB;
  631.             );
  632.         7: (
  633.             globalInfo:            TCPGlobalInfoPB;
  634.             );
  635.     END;
  636.  
  637.  
  638. CONST
  639.     UDPCreate                    = 20;
  640.     UDPRead                        = 21;
  641.     UDPBfrReturn                = 22;
  642.     UDPWrite                    = 23;
  643.     UDPRelease                    = 24;
  644.     UDPMaxMTUSize                = 25;
  645.     UDPStatus                    = 26;
  646.     UDPMultiCreate                = 27;
  647.     UDPMultiSend                = 28;
  648.     UDPMultiRead                = 29;
  649.     UDPCtlMax                    = 29;
  650.  
  651.     UDPDataArrival                = 1;
  652.     UDPICMPReceived                = 2;
  653.     lastUDPEvent                = 32767;
  654.  
  655.  
  656. TYPE
  657.     UDPEventCode                        = UInt16;
  658. {$IFC TYPED_FUNCTION_POINTERS}
  659.     UDPNotifyProcPtr = PROCEDURE(udpStream: StreamPtr; eventCode: UInt16; userDataPtr: Ptr; VAR icmpMsg: ICMPReport);
  660. {$ELSEC}
  661.     UDPNotifyProcPtr = ProcPtr;
  662. {$ENDC}
  663.  
  664.     UDPNotifyUPP = UniversalProcPtr;
  665.     udp_port                            = UInt16;
  666. { for create and release calls }
  667.     UDPCreatePBPtr = ^UDPCreatePB;
  668.     UDPCreatePB = RECORD
  669.         rcvBuff:                Ptr;
  670.         rcvBuffLen:                UInt32;
  671.         notifyProc:                UDPNotifyUPP;
  672.         localPort:                UInt16;
  673.         userDataPtr:            Ptr;
  674.         endingPort:                udp_port;
  675.     END;
  676.  
  677.     UDPSendPBPtr = ^UDPSendPB;
  678.     UDPSendPB = RECORD
  679.         reserved:                UInt16;
  680.         remoteHost:                ip_addr;
  681.         remotePort:                udp_port;
  682.         wdsPtr:                    Ptr;
  683.         checkSum:                BOOLEAN;
  684.         filler:                    SInt8;                                    {  Filler for proper byte alignment      }
  685.         sendLength:                UInt16;
  686.         userDataPtr:            Ptr;
  687.         localPort:                udp_port;
  688.     END;
  689.  
  690. { for receive and buffer return calls }
  691.     UDPReceivePBPtr = ^UDPReceivePB;
  692.     UDPReceivePB = RECORD
  693.         timeOut:                UInt16;
  694.         remoteHost:                ip_addr;
  695.         remotePort:                udp_port;
  696.         rcvBuff:                Ptr;
  697.         rcvBuffLen:                UInt16;
  698.         secondTimeStamp:        UInt16;
  699.         userDataPtr:            Ptr;
  700.         destHost:                ip_addr;                                {  only for use with multi rcv  }
  701.         destPort:                udp_port;                                {  only for use with multi rcv  }
  702.     END;
  703.  
  704.     UDPMTUPBPtr = ^UDPMTUPB;
  705.     UDPMTUPB = RECORD
  706.         mtuSize:                UInt16;
  707.         remoteHost:                ip_addr;
  708.         userDataPtr:            Ptr;
  709.     END;
  710.  
  711.     UDPiopbPtr = ^UDPiopb;
  712. {$IFC TYPED_FUNCTION_POINTERS}
  713.     UDPIOCompletionProcPtr = PROCEDURE(VAR iopb: UDPiopb); C;
  714. {$ELSEC}
  715.     UDPIOCompletionProcPtr = ProcPtr;
  716. {$ENDC}
  717.  
  718.     UDPIOCompletionUPP = UniversalProcPtr;
  719.     UDPiopb = RECORD
  720.         fill12:                    ARRAY [0..11] OF SInt8;
  721.         ioCompletion:            UDPIOCompletionUPP;
  722.         ioResult:                INTEGER;
  723.         ioNamePtr:                Ptr;
  724.         ioVRefNum:                INTEGER;
  725.         ioCRefNum:                INTEGER;
  726.         csCode:                    INTEGER;
  727.         udpStream:                StreamPtr;
  728.         CASE INTEGER OF
  729.         0: (
  730.             create:                UDPCreatePB;
  731.             );
  732.         1: (
  733.             send:                UDPSendPB;
  734.             );
  735.         2: (
  736.             receive:            UDPReceivePB;
  737.             );
  738.         3: (
  739.             mtu:                UDPMTUPB;
  740.             );
  741.     END;
  742.  
  743.  
  744. CONST
  745.     uppGetIPIOCompletionProcInfo = $000000C1;
  746.     uppIPIOCompletionProcInfo = $000000C1;
  747.     uppICMPEchoNotifyProcInfo = $000000C1;
  748.     uppTCPNotifyProcInfo = $0000EEC0;
  749.     uppTCPIOCompletionProcInfo = $000000C1;
  750.     uppUDPNotifyProcInfo = $00003EC0;
  751.     uppUDPIOCompletionProcInfo = $000000C1;
  752.  
  753. FUNCTION NewGetIPIOCompletionProc(userRoutine: GetIPIOCompletionProcPtr): GetIPIOCompletionUPP;
  754.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  755.     INLINE $2E9F;
  756.     {$ENDC}
  757.  
  758. FUNCTION NewIPIOCompletionProc(userRoutine: IPIOCompletionProcPtr): IPIOCompletionUPP;
  759.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  760.     INLINE $2E9F;
  761.     {$ENDC}
  762.  
  763. FUNCTION NewICMPEchoNotifyProc(userRoutine: ICMPEchoNotifyProcPtr): ICMPEchoNotifyUPP;
  764.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  765.     INLINE $2E9F;
  766.     {$ENDC}
  767.  
  768. FUNCTION NewTCPNotifyProc(userRoutine: TCPNotifyProcPtr): TCPNotifyUPP;
  769.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  770.     INLINE $2E9F;
  771.     {$ENDC}
  772.  
  773. FUNCTION NewTCPIOCompletionProc(userRoutine: TCPIOCompletionProcPtr): TCPIOCompletionUPP;
  774.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  775.     INLINE $2E9F;
  776.     {$ENDC}
  777.  
  778. FUNCTION NewUDPNotifyProc(userRoutine: UDPNotifyProcPtr): UDPNotifyUPP;
  779.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  780.     INLINE $2E9F;
  781.     {$ENDC}
  782.  
  783. FUNCTION NewUDPIOCompletionProc(userRoutine: UDPIOCompletionProcPtr): UDPIOCompletionUPP;
  784.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  785.     INLINE $2E9F;
  786.     {$ENDC}
  787.  
  788. PROCEDURE CallGetIPIOCompletionProc(VAR iopb: GetAddrParamBlock; userRoutine: GetIPIOCompletionUPP);
  789.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  790.     {To be implemented:  Glue to move parameters into registers.}
  791.     {$ENDC}
  792.  
  793. PROCEDURE CallIPIOCompletionProc(VAR iopb: ICMPParamBlock; userRoutine: IPIOCompletionUPP);
  794.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  795.     {To be implemented:  Glue to move parameters into registers.}
  796.     {$ENDC}
  797.  
  798. PROCEDURE CallICMPEchoNotifyProc(VAR iopb: ICMPParamBlock; userRoutine: ICMPEchoNotifyUPP);
  799.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  800.     {To be implemented:  Glue to move parameters into registers.}
  801.     {$ENDC}
  802.  
  803. PROCEDURE CallTCPNotifyProc(tcpStream: StreamPtr; eventCode: UInt16; userDataPtr: Ptr; terminReason: UInt16; VAR icmpMsg: ICMPReport; userRoutine: TCPNotifyUPP);
  804.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  805.     INLINE $205F, $4E90;
  806.     {$ENDC}
  807.  
  808. PROCEDURE CallTCPIOCompletionProc(VAR iopb: TCPiopb; userRoutine: TCPIOCompletionUPP);
  809.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  810.     {To be implemented:  Glue to move parameters into registers.}
  811.     {$ENDC}
  812.  
  813. PROCEDURE CallUDPNotifyProc(udpStream: StreamPtr; eventCode: UInt16; userDataPtr: Ptr; VAR icmpMsg: ICMPReport; userRoutine: UDPNotifyUPP);
  814.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  815.     INLINE $205F, $4E90;
  816.     {$ENDC}
  817.  
  818. PROCEDURE CallUDPIOCompletionProc(VAR iopb: UDPiopb; userRoutine: UDPIOCompletionUPP);
  819.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  820.     {To be implemented:  Glue to move parameters into registers.}
  821.     {$ENDC}
  822.  
  823. {$ALIGN RESET}
  824. {$POP}
  825.  
  826. {$SETC UsingIncludes := MacTCPIncludes}
  827.  
  828. {$ENDC} {__MACTCP__}
  829.  
  830. {$IFC NOT UsingIncludes}
  831.  END.
  832. {$ENDC}
  833.